package com.jzo2o.customer.controller.operation;


import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import com.jzo2o.customer.model.dto.response.WorkerCertificationAuditResDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 机构认证信息审核表 前端控制器
 * </p>
 *
 * @author xuchun
 * @since 2024-08-12
 */
@RestController("operationAgencyCertificationAuditController")
@RequestMapping("/operation/agency-certification-audit")
@Api(tags = "运营端 - 机构认证信息审核接口")
public class AgencyCertificationAuditController {
    @Resource
    private IAgencyCertificationAuditService agencyCertificationAuditService;

    @ApiOperation("审核服务人员认证分页查询")
    @GetMapping("/page")
    public PageResult<AgencyCertificationAuditResDTO> queryPage(AgencyCertificationAuditPageQueryReqDTO pageDTO) {
        return agencyCertificationAuditService.queryPage(pageDTO);
    }

    @ApiOperation("审核 服务人员提交的认证信息")
    @PutMapping("/audit/{id}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "认证申请ID", required = true, dataTypeClass = Long.class),
            @ApiImplicitParam(name = "certificationStatus", value = "认证状态：2：认证成功，3：认证失败", required = true, dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "rejectReason", value = "驳回原因", required = true, dataTypeClass = String.class)
    })
    public void audit(@PathVariable("id") Long id,
                      @RequestParam("certificationStatus") Integer certificationStatus,
                      @RequestParam("rejectReason") String rejectReason) {
        agencyCertificationAuditService.audit(id,certificationStatus,rejectReason);
    }


}
